/**
  ******************************************************************************
  * @file    SCK_Close.c
  * @author  exatron
  * @version V1.0.0
  * @date    segunda, 22 de dezembro de 2014
  * @brief   Função para fechar um socket.
  ******************************************************************************
  * @attention
  *
  *
  ******************************************************************************
  */

/**
  * @addtogroup SCK
  * @{
  */

/* Includes ------------------------------------------------------------------*/
#include <common.h>

BooleanType_t ISCLOSE = FALSE;

/* External functions --------------------------------------------------------*/

/**
  * @defgroup SCK_Functions
  * @{
  */

/**
  * @brief  Função para fechar um socket.
  * @param  SocketID_t: Socket a fechar
  * @retval Devolve pela serial Result_t
  */
void SCK_Close(SocketID_t id)
{
	#ifdef DEBUG
	debug_append(__FUNCTION__);
	#endif

	if(aux_CloseSocket(id) == Result_SocketClosed)
	{
		aux_USART0_puts("%s=%d;%d\r\n", "SCK_CLOS", id, Result_SocketClosed);
	}
	else if(id == TCP_ServerSocketID)
	{
		aux_USART0_puts("%s=%d;%d\r\n", "SCK_CLOS", id, Result_Ok);
	}
	else
	{
		ISCLOSE = TRUE;
	}

	aux_SetBusy(FALSE);
}

/**
  * @}
  */

/**
  * @}
  */





